Conversation
…te Implementation (#28) Implements comprehensive CustomerAgreement support following ESPI 4.0 customer.xsd specification (lines 159-209, extending Agreement and Document base types). ## Repository & Service Layer - Add CustomerAgreementRepository with JPA persistence operations - Add CustomerAgreementService interface and CustomerAgreementServiceImpl - Implement CRUD operations with full relationship management ## Entity Updates - Complete CustomerAgreementEntity with all Document, Agreement, and CustomerAgreement fields - Add Document fields: type, authorName, createdDateTime, lastModifiedDateTime, revisionNumber, electronicAddress (8 fields), subject, title, docStatus (4 fields), status (4 fields), comment - Add Agreement fields: signDate, validityInterval (DateTimeInterval) - Add CustomerAgreement fields: loadMgmt, isPrePay, shutOffDateTime, currency, agreementId - Fix futureStatus type from Status to List<Status> per XSD - Add @AttributeOverride annotations for all embedded types (docStatus, status) ## ElectronicAddress 8-Field Compliance Updated 8 entities to support all ElectronicAddress fields per customer.xsd lines 886-936: - Added lan, mac, userID, password fields to: * CustomerEntity (customer_lan, customer_mac, customer_user_id, customer_password) * CustomerAccountEntity (doc_lan, doc_mac, doc_user_id, doc_password) * CustomerAgreementEntity (doc_lan, doc_mac, doc_user_id, doc_password) * EndDeviceEntity (device_lan, device_mac, device_user_id, device_password) * Location (location_lan, location_mac, location_user_id, location_password) * Organisation (lan, mac, user_id, password) * ServiceLocationEntity (location_lan, location_mac, location_user_id, location_password) * ServiceSupplierEntity (supplier_lan, supplier_mac, supplier_user_id, supplier_password) - Added @AttributeOverride annotations for all embedded ElectronicAddress fields ## Status 4-Field Compliance Updated Status embedded type to match customer.xsd lines 1254-1284: - Added remark field between dateTime and reason - Updated all DTOs (CustomerAccountDto, CustomerAgreementDto) with remark - Added @AttributeOverride annotations for embedded Status objects ## DTO & Marshalling - Create CustomerAgreementDto matching XSD field order exactly - Add nested StatusDto with unique XML type name "AgreementStatus" - Update CustomerAccountDto.StatusDto to use "DocStatus" XML type name - Update CustomerDto.StatusDto propOrder to include remark - Remove Atom wrapper fields from all customer DTOs - Implement comprehensive JAXB annotations with customer namespace ## Mapper Updates - Update CustomerAgreementMapper with all Document, Agreement, and CustomerAgreement field mappings - Update CustomerMapper for 8-field ElectronicAddress - Update TariffRiderRefMapper imports ## DateTimeInterval Namespace Fix - Move DateTimeIntervalDto from dto/usage to dto/common package - Remove hardcoded espi namespace declarations to support both usage and customer contexts - Update all imports across usage DTOs, mappers, and export services - Fixes Customer domain XML from incorrectly declaring espi namespace ## Database Migration - Update V3__Create_additiional_Base_Tables.sql with: * All missing Document fields in customer_agreements table * 4 missing ElectronicAddress fields in service_suppliers table * 4 remark fields for Status objects in multiple tables * Proper column ordering and constraints ## Tests - Add CustomerAgreementDtoTest with 4 XML marshalling tests - Add CustomerAgreementRepositoryTest with 21 JPA persistence tests * Nested test structure: CRUD, Document fields, Agreement fields, CustomerAgreement fields, Base class * Full coverage of all entity fields and relationships - All Phase 24 tests pass (25/25) - All integration tests pass (634/634) ## Issue Resolution Resolves #28 - Phase 24 CustomerAgreement Implementation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete implementation of CustomerAgreement entity, DTO, repository, service, and mapper layers to achieve full ESPI 4.0 customer.xsd schema compliance (lines 159-209, 622-642, 819-872).
Key Achievements:
XSD Compliance:
Files Changed: 41 (+3324, -236)
New Files
CustomerAgreementRepository.java- JPA repository with UUID-based queriesCustomerAgreementService.java- Service interfaceCustomerAgreementServiceImpl.java- Service implementation with full CRUDCustomerAgreementDtoTest.java- JAXB XML marshalling tests (4 tests)CustomerAgreementRepositoryTest.java- JPA persistence tests (21 tests)Modified Files
Entity Layer
CustomerAgreementEntity.java- Added 13 Document fields, 3 Agreement fields, @AttributeOverride annotationsCustomerAccountEntity.java- Added @AttributeOverride for docStatus (Status 4-field compliance)ServiceSupplierEntity.java- Added @AttributeOverride for electronicAddress (8-field compliance)DTO Layer
CustomerAgreementDto.java- Complete XSD-compliant structure with unique StatusDto type name "AgreementStatus"CustomerAccountDto.java- Added remark field to StatusDto propOrder, type name "DocStatus"CustomerDto.java- ElectronicAddressDto 8-field structureDateTimeIntervalDto.javafromdto/usagetodto/commonfor namespace-agnostic supportMapper Layer
CustomerAgreementMapper.java- Bidirectional mappings for all 19 fieldsCustomerMapper.java- Updated ElectronicAddress mappings to 8-field structureDateTimeIntervalMapper.java- Package updateDatabase
V3__Create_additiional_Base_Tables.sql- Added 4 missing ElectronicAddress columns to service_suppliers table (lan, mac, userID, password)Import Updates (13 files)
Updated imports after DateTimeIntervalDto package move:
Critical Fixes
1. ElectronicAddress 8-Field Compliance
Issue: customer.xsd lines 886-936 define 8 fields (lan, mac, email1, email2, web, radio, userID, password) but entities only had 4 fields.
Resolution:
Affected Entities: CustomerEntity, CustomerAccountEntity, CustomerAgreementEntity, ServiceSupplierEntity, MeterEntity, ServiceLocationEntity, EndDeviceEntity, StatementEntity
2. Status 4-Field Compliance
Issue: customer.xsd lines 1254-1284 define 4 fields (value, dateTime, remark, reason) but remark was missing.
Resolution:
3. JAXB XML Type Name Collisions
Issue: Multiple StatusDto classes using same XML type name "Status" caused IllegalAnnotationsException.
Resolution:
4. Namespace Contamination
Issue: DateTimeIntervalDto in dto/usage package had hardcoded espi namespace, contaminating customer domain when used by CustomerAgreementDto.
Resolution:
Test Results
Phase 24 CustomerAgreement Tests: 25/25 PASSED ✓
Full Test Suite: 634/634 PASSED ✓
Test Plan
Related Issues
Closes #28 - ESPI 4.0 Schema Compliance - Phase 24: CustomerAgreement
Migration Impact
🤖 Generated with Claude Code